<template>
  <el-config-provider :locale="appStore.locale" :size="size">
    <router-view v-if="isRouterAlive"/>
  </el-config-provider>
</template>

<script setup lang="ts">
import useSettingsStore from '@/store/modules/settings'
import { handleThemeStyle } from '@/utils/theme'
import useAppStore from '@/store/modules/app';

const appStore = useAppStore();
const size = computed(() => appStore.size as any);
const isRouterAlive = ref(true)

const reload = () => {
    isRouterAlive.value = false
    nextTick(function () {
      isRouterAlive.value = true
    })
}
provide ('reload', reload) ;

onMounted(() => {
  nextTick(() => {
    // 初始化主题样式
    handleThemeStyle(useSettingsStore().theme)
  })
})
</script>
